import re

import requests
from bs4 import BeautifulSoup

url = 'http://books.toscrape.com/catalogue/page-1.html'
base_url = 'http://books.toscrape.com/catalogue/'

response = requests.get(url)
html = response.text
print(html)
soup = BeautifulSoup(html, 'html.parser')
results = re.findall(r'\s<a href="(.*?/index.html)"><img src="..(.*?.jpg)" alt="(.*?)" class="thumbnail"></a>', html)
for result in results:
    detail_url = base_url + result[0]
    img_url = 'http://books.toscrape.com' + result[1]
    name = result[2]
    print(detail_url, img_url, name)
